<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

/**
 * model基类
 */
class Common extends Model
{
    //查询所有数据
    public function selall($table){
        $sql = "select * from $table";
        return DB::select($sql);
    }
    //查询单条数据
    public static function selone($table,$name,$id){
        $sql = "select * from $table WHERE $name=$id limit 0,1";
        return DB::select($sql);
    }
    //删除单条数据
    public function delone($table,$name,$id){
        $sql = "delete from $table WHERE $name in ($id)";
        return DB::delete($sql);
    }
    //添加数据
}